// 所有的错误码集中处理
module.exports = {
  SUCCESS: (data) => {   // 成功返回
    const ret = {
      "errcode": 0,
      "errmsg": "success"
    }
    if (data) {
      ret.data = data
    }
    return ret
  },
  SYSTEM_BUSY: {  // 系统繁忙
    "errcode": -1,
    "errmsg": "system busy"
  },
  NO_PERMISSION: {  // 没有权限访问
    "errcode": 1,
    "errmsg": "no permission, Please check if you have token"
  },
  TOKEN_INVALID: {  // token无效
    "errcode": 2,
    "errmsg": "no permission, token invalid"
  },
  TOKEN_EXPIRED: {  // token过期
    "errcode": 3,
    "errmsg": "has permission, but token is already expired"
  },
  TOKEN_INACTIVE: {  // token未激活
    "errcode": 4,
    "errmsg": "has permission, but token has not yet reached the available time."
  },
  USERNAME_EMPTY: {  // 用户名不可为空
    "errcode": 100,
    "errmsg": "username must not be empty"
  },
  USERNAME_NOT_EXIST: {  // 用户名不存在
    "errcode": 101,
    "errmsg": "username does not exist"
  },
  PASSWORD_INVALID: {  // 密码错误
    "errcode": 121,
    "errmsg": "Incorrect password"
  },
  PASSWORD_EMPTY: {  // 密码不可为空
    "errcode": 122,
    "errmsg": "password must not be empty"
  },
  NEW_PASSWORD_EMPTY: {  // 新密码不可为空
    "errcode": 123,
    "errmsg": "new password must not be empty"
  },
  SAME_PASSWORD: {  // 新密码必须和旧密码不相同
    "errcode": 124,
    "errmsg": "The new password must be different from the old password"
  },
  PAYMENT_NAME_EMPTY: { // 支付类型的名称不可为空
    "errcode": 151,
    "errmsg": "The name of payment type must not be empty"
  },
  PAYMENT_NAME_EXIST: { // 支付类型的名称已存在
    "errcode": 152,
    "errmsg": "Payment type name already exists"
  },
  PAYMENT_CODE_EMPTY: { // 支付类型的标识不可为空
    "errcode": 153,
    "errmsg": "The code of payment type must not be empty"
  },
  PAYMENT_CODE_EXIST: { // 支付类型的标识已存在
    "errcode": 154,
    "errmsg": "Payment type code already exists"
  },
  PAYMENT_CODE_INVALID: { // 支付类型的标识无效(必须是英文大小写)
    "errcode": 155,
    "errmsg": "Payment type code invalid, can only include uppercase and lowercase"
  },
  PAYMENT_ID_INVALID: { // 支付类型的id无效
    "errcode": 156,
    "errmsg": "Payment id invalid"
  },
  ENDPOINT_EMPTY: { // 节点不可为空
    "errcode": 181,
    "errmsg": "Endpoint must not be empty"
  },
  ENDPOINT_EXIST: { // 节点已存在
    "errcode": 182,
    "errmsg": "Endpoint already exists"
  },
  ENDPOINT_ID_INVALID: { // 节点id无效
    "errcode": 183,
    "errmsg": "Endpoint id invalid"
  },
  ENDPOINT_STATUS_INVALID: {  // 节点状态无效
    "errcode": 184,
    "errmsg": "Endpoint status invalid"
  },
  UPLOAD_NOTHING: {
    "errcode": 300,
    "errmsg": "Nothing to upload" // 没有上传文件
  },
  UPLOAD_FILEGROUP_INVALID: {
    "errcode": 301,
    "errmsg": "upload fileGroup invalid" // 文件组无效
  },
  APP_UNFULL: {
    "errcode": 400,
    "errmsg": "third party app info is unfull" // app信息不全
  },
  APPNAME_EXIST: {
    "errcode": 401,
    "errmsg": "third party appName already exists" // app名称已存在
  },
  APP_UIOPTIONS_INVALID: {
    "errcode": 402,
    "errmsg": "third party uiOptions invalid" // app uiOptions数据格式有误
  },
  APP_DISTINCT_FIELD_INVALID: {
    "errcode": 403,
    "errmsg": "third party distinct field invalid" // app分类字段无效
  },
  APP_SEQNUM_INVALID: {
    "errcode": 404,
    "errmsg": "third party seqNum must be number" // app发布顺序必须是正整数
  },
  APP_ID_LIST_EMPTY: {
    "errcode": 405,
    "errmsg": "app id list must not be empty" // app id list不可为空
  }
};
